﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<script language="c#" runat="server">
protected string Condition()
{
	StringBuilder condition = new StringBuilder();
	string and = String.Empty;

	#region 是否显示
	string isDisplay = Request.QueryString["IsDisplay"];
	if (isDisplay == null)
		condition.Append(Alias.LinkCategory.IsDisplay + "=true");
	else if (isDisplay != String.Empty)
		condition.Append(Alias.LinkCategory.IsDisplay + "=" + isDisplay);
	#endregion

	if (and == String.Empty && condition.Length != 0)
		and = " AND ";

	#region 是否推荐
	string isRecommended = Request.QueryString["IsRecommended"];
	if (!String.IsNullOrEmpty(isRecommended))
		condition.Append(and + Alias.LinkCategory.IsRecommended + "=" + isRecommended);
	#endregion

	if (and == String.Empty && condition.Length != 0)
		and = " AND ";

	#region 是否置顶
	string isHeld = Request.QueryString["IsHeld"];
	if (!String.IsNullOrEmpty(isHeld))
		condition.Append(and + Alias.LinkCategory.IsHeld + "=" + isHeld);
	#endregion
	
	return condition.ToString();
}

protected string Sort()
{
	string sort = String.Empty;
	switch (Request.QueryString["Sort"])
	{
		case "1":
			sort = Alias.LinkCategory.Sort + " ASC";
			break;
		case "2":
			sort = Alias.LinkCategory.Recommend + " DESC";
			break;
		case "3":
			sort = Alias.LinkCategory.Recommend + " ASC";
			break;
		case "4":
			sort = Alias.LinkCategory.Hold + " DESC";
			break;
		case "5":
			sort = Alias.LinkCategory.Hold + " ASC";
			break;
		default:
			sort = Alias.LinkCategory.Sort + " ASC";
			break;
	}
	
	return sort;
}
</script>
<section data-page="link_category_list" data-title="类别列表" data-lang="<%=ContentLang%>">
	<dl class="path1">
		<dt><span>您的位置：</span>类别列表</dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<div class="ali-tabs sub-nav" data-height-style="fill" data-event="click">
		<div class="ali-tabs-header">
			<div class="ali-tabs-nav-container">
				<ul>
					<li><a href="../link/list.aspx?Lang=<%=ContentLang%>" target="ali-navtab">链接列表</a></li>
					<li><a href="../link/add.aspx?Lang=<%=ContentLang%>" target="ali-navtab">添加链接</a></li>
					<li class="ali-active"><a>类别列表</a></li>
					<li><a href="add.aspx?Lang=<%=ContentLang%>" target="ali-navtab">添加类别</a></li>
				</ul>				
			</div>
		</div>
		<div class="ali-tabs-body">
			<div class="ali-tabs-panel"></div>
			<div class="ali-tabs-panel"></div>
			<div class="ali-tabs-panel">						
				<form action="" class="search1">
					<select name="IsDisplay" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
						<option value="">是否显示</option>
						<option value="false">未显示</option>
						<option value="true" selected>已显示</option>
					</select>
					<select name="IsRecommended" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
						<option value="">是否推荐</option>
						<option value="false">未推荐</option>
						<option value="true">已推荐</option>
					</select>
					<select name="IsHeld" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
						<option value="">是否置顶</option>
						<option value="false">未置顶</option>
						<option value="true">已置顶</option>
					</select>
					<select name="Sort" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
						<option value="1" selected="selected">手动排序</option>
						<option value="2">推荐↓</option>
						<option value="3">推荐↑</option>
						<option value="4">置顶↓</option>
						<option value="5">置顶↑</option>
					</select>
				</form>
				<ul class="toolbar1">
					<li class="select-all"><a><span>全选</span></a></li>
					<li class="select-reverse"><a><span>反选</span></a></li>
			
					<li class="display" data-operation="Display"><a><span>显示</span></a></li>
					<li class="undisplay" data-operation="UnDisplay"><a><span>取消显示</span></a></li>
				</ul>
				<div class="content">
					<table data-ali-widget="grid" class="grid1" data-tree="true" data-root="">
						<thead>
							<tr>
								<th width="50">移动</th>
								<th>名称及层次</th>
								<th width="80">浏览文章</th>
								<th width="80">添加子类别</th>
								<th width="80">删除</th>
							</tr>
						</thead>
						<tbody>
                            <ali:List Object="LinkCategory"  Condition="Condition()" Sort="Sort()" Validate="True">
                                <ali:Record>
                                    <tr data-id="<%=InnerID%>">
                                         <td data-sort="<%=InnerID%>" data-name="<%=Name%>"><%=InnerID%></td>
										 <td data-item="<%=InnerID%>" data-parent="<%=ParentID%>"   class="<%=ContentLang%>Font"><a href="edit.aspx?Lang=<%=ContentLang%>&amp;ID=<%=InnerID%>" target="ali-navtab"><%=Name%></a></td>
										 <td><a href="../link/list.aspx?Lang=<%=ContentLang%>&amp;CategoryID=<%=ID%>" target="ali-navtab">浏览链接</a></td>
										 <td><a href="../link_category/add.aspx?Lang=<%=ContentLang%>&amp;ParentID=<%=ID%>" target="ali-navtab">添加子类别</a></td>
                                         <td><a class="ali-button" data-operation="Delete">删除</a></td>
                                    </tr>
                                </ali:Record>
                            </ali:List>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="ali-tabs-bottom"><b></b></div>
	</div>
</section>